home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
c
/
vbccwossrc.lha
/
vbcc
/
pasm
/
predefs.c
< prev
next >
Wrap
Text File
|
1999-03-07
|
25KB
|
514 lines
/* $VER: pasm predefs.c V1.2 (21.10.98)
*
* This file is part of pasm, a portable PowerPC assembler.
* Copyright (c) 1997-98 Frank Wille
*
* pasm is freeware and part of the portable and retargetable ANSI C
* compiler vbcc, copyright (c) 1995-98 by Volker Barthelmann.
* pasm may be freely redistributed as long as no modifications are
* made and nothing is charged for it. Non-commercial usage is allowed
* without any restrictions.
* EVERY PRODUCT OR PROGRAM DERIVED DIRECTLY FROM MY SOURCE MAY NOT BE
* SOLD COMMERCIALLY WITHOUT PERMISSION FROM THE AUTHOR.
*
*
* v1.2 (21.10.98) phx
* Predefining some more sections:
* .sdata, .sdata2, .sbss, .init, .fini
* Increased aligment constraints to 16-bytes (SVR4/EABI).
* v0.7 (21.11.97) phx
* Missing extended mnemonics: mr. and not.
* Fixed out of range warnings in extrwi, inslwi, rotwri and srwi.
* v0.6 (26.10.97) phx
* @object and @function were removed from stdsets. They are
* always defined during assembler initialization (pass.c).
* v0.4 (29.04.97) phx
* Renamed .toc into .tocd.
* Base relative addressing mode defaults to .baserel .tocd,2
* v0.2 (24.03.97) phx
* Writes ELF object for 32-bit PowerPC big-endian. Either absolute
* or ELF output format may be selected. ELF is default for all
* currently supported platforms. PPCasm supports nine different
* relocation types (there are much more...).
* Compiles and works also under NetBSD/amiga (68k).
* Changed function declaration to 'new style' in all sources
* (to avoid problems with '...' for example).
* Changed type of predefinition texts from character-constant
* to character-array, to avoid bus errors on systems with
* memory protection.
* .rwdata and .rdata section predefinitions deleted.
* v0.1 (11.03.97) phx
* First test version with all PowerPC instructions and most
* important directives. Only raw, absolute output.
* I'm still uncertain about the sense of the sections .rodata,
* .rdata and .rwdata (where .rodata and .rdata seem indentical
* anyway). .toc isn't supported. .bss can't be activated by its
* name, because there is a directive called .bss.
* Some 64-bit extended macros are missing, e.g. for shifting.
* v0.0 (21.02.97) phx
* File created.
*/
char stdsects[] =
".section .text,\"crx4\"\n"
".section .data,\"drw4\"\n"
".section .rodata,\"dr4\"\n"
".section .sdata,\"drw4\"\n"
".section .sdata2,\"dr4\"\n"
".section .bss,\"urw4\"\n"
".section .sbss,\"urw4\"\n"
".section .init,\"crx4\"\n"
".section .fini,\"crx4\"\n"
".section .tocd,\"drw4\"\n"
".text\n" /* activate .text section */
".baserel .tocd,2\n"; /* default base relative mode = TOC */
char stdsets[] =
".set r0,0\n.set r1,1\n.set r2,2\n.set r3,3\n"
".set r4,4\n.set r5,5\n.set r6,6\n.set r7,7\n"
".set r8,8\n.set r9,9\n.set r10,10\n.set r11,11\n"
".set r12,12\n.set r13,13\n.set r14,14\n.set r15,15\n"
".set r16,16\n.set r17,17\n.set r18,18\n.set r19,19\n"
".set r20,20\n.set r21,21\n.set r22,22\n.set r23,23\n"
".set r24,24\n.set r25,25\n.set r26,26\n.set r27,27\n"
".set r28,28\n.set r29,29\n.set r30,30\n.set r31,31\n"
".set f0,0\n.set f1,1\n.set f2,2\n.set f3,3\n"
".set f4,4\n.set f5,5\n.set f6,6\n.set f7,7\n"
".set f8,8\n.set f9,9\n.set f10,10\n.set f11,11\n"
".set f12,12\n.set f13,13\n.set f14,14\n.set f15,15\n"
".set f16,16\n.set f17,17\n.set f18,18\n.set f19,19\n"
".set f20,20\n.set f21,21\n.set f22,22\n.set f23,23\n"
".set f24,24\n.set f25,25\n.set f26,26\n.set f27,27\n"
".set f28,28\n.set f29,29\n.set f30,30\n.set f31,31\n"
".set cr0,0\n.set cr1,1\n.set cr2,2\n.set cr3,3\n"
".set cr4,4\n.set cr5,5\n.set cr6,6\n.set cr7,7\n"
".set lt,0\n.set gt,1\n.set eq,2\n.set so,3\n.set un,3\n"
".set sp,1\n.set rtoc,2\n.set fp,31\n.set fpscr,0\n"
".set xer,1\n.set lr,8\n.set ctr,9\n";
char *xmnemos[] = {
".macro subi\n addi \\1,\\2,-(\\3)\n.endm\n",
".macro subis\n addis \\1,\\2,-(\\3)\n.endm\n",
".macro subic\n addic \\1,\\2,-(\\3)\n.endm\n",
".macro subic.\n addic. \\1,\\2,-(\\3)\n.endm\n",
".macro sub\n subf \\1,\\3,\\2\n.endm\n",
".macro sub.\n subf. \\1,\\3,\\2\n.endm\n",
".macro subo\n subfo \\1,\\3,\\2\n.endm\n",
".macro subo.\n subfo. \\1,\\3,\\2\n.endm\n",
".macro subc\n subfc \\1,\\3,\\2\n.endm\n",
".macro subc.\n subfc. \\1,\\3,\\2\n.endm\n",
".macro subco\n subfco \\1,\\3,\\2\n.endm\n",
".macro subco.\n subfco. \\1,\\3,\\2\n.endm\n",
".macro cmpwi\n.ifeq $NARG-2\n cmpi 0,0,\\1,\\2\n"
".else\n cmpi \\1,0,\\2,\\3\n.endif\n.endm\n",
".macro cmpw\n.ifeq $NARG-2\n cmp 0,0,\\1,\\2\n"
".else\n cmp \\1,0,\\2,\\3\n.endif\n.endm\n",
".macro cmplwi\n.ifeq $NARG-2\n cmpli 0,0,\\1,\\2\n"
".else\n cmpli \\1,0,\\2,\\3\n.endif\n.endm\n",
".macro cmplw\n.ifeq $NARG-2\n cmpl 0,0,\\1,\\2\n"
".else\n cmpl \\1,0,\\2,\\3\n.endif\n.endm\n",
".macro cmpdi\n.ifeq $NARG-2\n cmpi 0,1,\\1,\\2\n"
".else\n cmpi \\1,1,\\2,\\3\n.endif\n.endm\n",
".macro cmpd\n.ifeq $NARG-2\n cmp 0,1,\\1,\\2\n"
".else\n cmp \\1,1,\\2,\\3\n.endif\n.endm\n",
".macro cmpldi\n.ifeq $NARG-2\n cmpli 0,1,\\1,\\2\n"
".else\n cmpli \\1,1,\\2,\\3\n.endif\n.endm\n",
".macro cmpld\n.ifeq $NARG-2\n cmpl 0,1,\\1,\\2\n"
".else\n cmpl \\1,1,\\2,\\3\n.endif\n.endm\n",
".macro extlwi\n rlwinm \\1,\\2,\\4,0,(\\3)-1\n.endm\n",
".macro extlwi.\n rlwinm. \\1,\\2,\\4,0,(\\3)-1\n.endm\n",
".macro extrwi\n rlwinm \\1,\\2,((\\4)+(\\3))&31,32-(\\3),31\n.endm\n",
".macro extrwi.\n rlwinm. \\1,\\2,((\\4)+(\\3))&31,32-(\\3),31\n.endm\n",
".macro inslwi\n rlwimi \\1,\\2,(32-(\\4))&31,\\4,((\\4)+(\\3))-1\n.endm\n",
".macro inslwi.\n rlwimi. \\1,\\2,(32-(\\4))&31,\\4,((\\4)+(\\3))-1\n.endm\n",
".macro insrwi\n rlwimi \\1,\\2,32-((\\4)+(\\3)),\\4,((\\4)+(\\3))-1\n.endm\n",
".macro insrwi.\n rlwimi. \\1,\\2,32-((\\4)+(\\3)),\\4,((\\4)+(\\3))-1\n.endm\n",
".macro rotlwi\n rlwinm \\1,\\2,\\3,0,31\n.endm\n",
".macro rotlwi.\n rlwinm. \\1,\\2,\\3,0,31\n.endm\n",
".macro rotrwi\n rlwinm \\1,\\2,(32-(\\3))&31,0,31\n.endm\n",
".macro rotrwi.\n rlwinm. \\1,\\2,(32-(\\3))&31,0,31\n.endm\n",
".macro rotlw\n rlwnm \\1,\\2,\\3,0,31\n.endm\n",
".macro rotlw.\n rlwnm. \\1,\\2,\\3,0,31\n.endm\n",
".macro slwi\n rlwinm \\1,\\2,\\3,0,31-(\\3)\n.endm\n",
".macro slwi.\n rlwinm. \\1,\\2,\\3,0,31-(\\3)\n.endm\n",
".macro srwi\n rlwinm \\1,\\2,(32-(\\3))&31,\\3,31\n.endm\n",
".macro srwi.\n rlwinm. \\1,\\2,(32-(\\3))&31,\\3,31\n.endm\n",
".macro clrlwi\n rlwinm \\1,\\2,0,\\3,31\n.endm\n",
".macro clrlwi.\n rlwinm. \\1,\\2,0,\\3,31\n.endm\n",
".macro clrrwi\n rlwinm \\1,\\2,0,0,31-(\\3)\n.endm\n",
".macro clrrwi.\n rlwinm. \\1,\\2,0,0,31-(\\3)\n.endm\n",
".macro clrlslwi\n rlwinm \\1,\\2,\\4,(\\3)-(\\4),31-(\\4)\n.endm\n",
".macro clrlslwi.\n rlwinm. \\1,\\2,\\4,(\\3)-(\\4),31-(\\4)\n.endm\n",
".macro bt\n bc\\0 12,\\1,\\2\n.endm\n",
".macro bf\n bc\\0 4,\\1,\\2\n.endm\n",
".macro bdnz\n bc\\0 16,0,\\1\n.endm\n",
".macro bdnzt\n bc\\0 8,\\1,\\2\n.endm\n",
".macro bdnzf\n bc\\0 0,\\1,\\2\n.endm\n",
".macro bdz\n bc\\0 18,0,\\1\n.endm\n",
".macro bdzt\n bc\\0 10,\\1,\\2\n.endm\n",
".macro bdzf\n bc\\0 2,\\1,\\2\n.endm\n",
".macro bta\n bca\\0 12,\\1,\\2\n.endm\n",
".macro bfa\n bca\\0 4,\\1,\\2\n.endm\n",
".macro bdnza\n bca\\0 16,0,\\1\n.endm\n",
".macro bdnzta\n bca\\0 8,\\1,\\2\n.endm\n",
".macro bdnzfa\n bca\\0 0,\\1,\\2\n.endm\n",
".macro bdza\n bca\\0 18,0,\\1\n.endm\n",
".macro bdzta\n bca\\0 10,\\1,\\2\n.endm\n",
".macro bdzfa\n bca\\0 2,\\1,\\2\n.endm\n",
".macro blr\n bclr 20,0\n.endm\n",
".macro btlr\n bclr\\0 12,\\1\n.endm\n",
".macro bflr\n bclr\\0 4,\\1\n.endm\n",
".macro bdnzlr\n bclr\\0 16,0\n.endm\n",
".macro bdnztlr\n bclr\\0 8,\\1\n.endm\n",
".macro bdnzflr\n bclr\\0 0,\\1\n.endm\n",
".macro bdzlr\n bclr\\0 18,0\n.endm\n",
".macro bdztlr\n bclr\\0 10,\\1\n.endm\n",
".macro bdzflr\n bclr\\0 2,\\1\n